<?php
	header("Content-type:text/html;charset=utf-8");
		
	$conn = mysql_connect("localhost","root","123456");
	
	mysql_select_db("mylol");
	
	$result = mysql_query("select * from goods",$conn);
	
	    $json = '';
	    $data = array();
	    class GoodsInfor{};
	    while ($row = mysql_fetch_assoc($result))
	      {
	      $goodsinfor = new GoodsInfor();
	      $goodsinfor->goods_id = $row["g_id"];
	      $goodsinfor->goods_img = $row["g_img"];
	      $goodsinfor->goods_name = $row["g_name"];
	      $goodsinfor->goods_price = $row["g_price"];
	      $data[]=$goodsinfor;
	      }
	      $json = json_encode($data);//把数据转换为JSON数据.
	      echo $json;
?> 
